- Prelude
- @catch <A> (Error error, Func<Error, A> Fail)
- @catchM <M, A> (Error error, Func<Error, K<M, A>> Fail)
- @catch (Error error, Func<Error, Error> Fail)
- @catch <A> (Error error, A Fail)
- @catchM <M, A> (Error error, K<M, A> Fail)
- @catch (Error error, Error Fail)
- @catch <A> (int errorCode, Func<Error, A> Fail)
- @catchM <M, A> (int errorCode, Func<Error, K<M, A>> Fail)
- @catch (int errorCode, Func<Error, Error> Fail)
- @catch <A> (int errorCode, A Fail)
- @catchM <M, A> (int errorCode, K<M, A> Fail)
- @catch (int errorCode, Error Fail)
- @catch <A> (Func<Error, bool> predicate, Func<Error, A> Fail)
- @catchM <M, A> (Func<Error, bool> predicate, Func<Error, K<M, A>> Fail)
- @catch (Func<Error, bool> predicate, Func<Error, Error> Fail)
- @catch <A> (Func<Error, bool> predicate, A Fail)
- @catchM <M, A> (Func<Error, bool> predicate, K<M, A> Fail)
- @catch (Func<Error, bool> predicate, Error Fail)
- @catch (Error Fail)
- @catch <A> (A Fail)
- @catchM <M, A> (K<M, A> Fail)
- @catchM <M, A> (Func<Error, K<M, A>> Fail)
- @catchOf <E, A> (Func<E, A> Fail)
- @catchOfM <E, M, A> (Func<E, K<M, A>> Fail)
- @catchOf <E> (Func<E, Error> Fail)
- @expected <A> (Func<Expected, A> Fail)
- @expectedM <M, A> (Func<Expected, K<M, A>> Fail)
- @expected (Func<Expected, Error> Fail)
- @expectedOf <E, A> (Func<E, A> Fail)
- @expectedOfM <E, M, A> (Func<E, K<M, A>> Fail)
- @expectedOf <E> (Func<E, Error> Fail)
- @exceptional <A> (Func<Exceptional, A> Fail)
- @exceptionalM <M, A> (Func<Exceptional, K<M, A>> Fail)
- @exceptional (Func<Exceptional, Error> Fail)
- @exceptionalOf <E, A> (Func<E, A> Fail)
- @exceptionalOfM <E, M, A> (Func<E, K<M, A>> Fail)
- @exceptionalOf <E> (Func<E, Error> Fail)
The @catch
functions produce a CatchError
or CatchValue
type. These can be composed together with the
Aff
and Eff
monads (and maybe more in the future), to create a functional-programming equivalent to
exception catching and matching.
public class TimeoutExample<RT>
where RT : struct,
HasTime<RT>,
HasCancel<RT>,
HasConsole<RT>
{
public static Aff<RT, Unit> main =>
from _1 in timeout(60 * seconds, longRunning)
| @catch(Errors.TimedOut, unit)
from _2 in Console<RT>.writeLine("done")
select unit;
static Aff<RT, Unit> longRunning =>
(from tm in Time<RT>.now
from _1 in Console<RT>.writeLine(tm.ToLongTimeString())
select unit)
.ToAff()
.Repeat(Schedule.Fibonacci(1 * second));
}
method CatchValue<A> @catch <A> (Error error, Func<Error, A> Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<M, A> @catchM <M, A> (Error error, Func<Error, K<M, A>> Fail) Source #
Catch an error if the error matches the argument provided
method CatchError @catch (Error error, Func<Error, Error> Fail) Source #
Catch an error if the error matches the argument provided
method CatchValue<A> @catch <A> (Error error, A Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<M, A> @catchM <M, A> (Error error, K<M, A> Fail) Source #
Catch an error if the error matches the argument provided
method CatchError @catch (Error error, Error Fail) Source #
Catch an error if the error matches the argument provided
method CatchValue<A> @catch <A> (int errorCode, Func<Error, A> Fail) Source #
Catch an error if the error Code
matches the errorCode
argument provided
method CatchM<M, A> @catchM <M, A> (int errorCode, Func<Error, K<M, A>> Fail) Source #
Catch an error if the error matches the argument provided
method CatchError @catch (int errorCode, Func<Error, Error> Fail) Source #
Catch an error if the error Code
matches the errorCode
argument provided
method CatchValue<A> @catch <A> (int errorCode, A Fail) Source #
Catch an error if the error Code
matches the errorCode
argument provided
method CatchM<M, A> @catchM <M, A> (int errorCode, K<M, A> Fail) Source #
Catch an error if the error matches the argument provided
method CatchError @catch (int errorCode, Error Fail) Source #
Catch an error if the error Code
matches the errorCode
argument provided
method CatchValue<A> @catch <A> (Func<Error, bool> predicate, Func<Error, A> Fail) Source #
Catch an error
method CatchM<M, A> @catchM <M, A> (Func<Error, bool> predicate, Func<Error, K<M, A>> Fail) Source #
Catch an error if the error matches the argument provided
method CatchValue<A> @catch <A> (Func<Error, bool> predicate, A Fail) Source #
Catch an error if it's of a specific exception type
method CatchM<M, A> @catchM <M, A> (Func<Error, bool> predicate, K<M, A> Fail) Source #
Catch an error if the error matches the argument provided
method CatchError @catch (Func<Error, bool> predicate, Error Fail) Source #
Catch an error if it's of a specific exception type
method CatchM<M, A> @catchM <M, A> (Func<Error, K<M, A>> Fail) Source #
Catch all errors and return Fail
method CatchM<M, A> @catchOfM <E, M, A> (Func<E, K<M, A>> Fail) Source #
Catch all errors and return Fail
method CatchM<M, A> @expectedM <M, A> (Func<Expected, K<M, A>> Fail) Source #
Catch all errors and return Fail
method CatchValue<A> @expectedOf <E, A> (Func<E, A> Fail) Source #
Catch expected errors
method CatchM<M, A> @expectedOfM <E, M, A> (Func<E, K<M, A>> Fail) Source #
Catch all errors and return Fail
method CatchError @expectedOf <E> (Func<E, Error> Fail) Source #
Catch expected errors
method CatchValue<A> @exceptional <A> (Func<Exceptional, A> Fail) Source #
Catch exceptional errors
method CatchM<M, A> @exceptionalM <M, A> (Func<Exceptional, K<M, A>> Fail) Source #
Catch all errors and return Fail
method CatchError @exceptional (Func<Exceptional, Error> Fail) Source #
Catch exceptional errors
method CatchValue<A> @exceptionalOf <E, A> (Func<E, A> Fail) Source #
Catch exceptional errors
method CatchM<M, A> @exceptionalOfM <E, M, A> (Func<E, K<M, A>> Fail) Source #
Catch all errors and return Fail
method CatchError @exceptionalOf <E> (Func<E, Error> Fail) Source #
Catch exceptional errors